package com.fromfuture.xuhuidoc.android.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by 何送军 on 2017/8/17.
 */

public class MainFrameActivityViewPageFragmentAdapter  extends FragmentStatePagerAdapter{

    private List<Fragment> fragmentList;

    public MainFrameActivityViewPageFragmentAdapter(FragmentManager fm,List<Fragment> fragmentList) {
        super(fm);
        this.fragmentList=fragmentList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public int getItemPosition(Object object) {
//        return super.getItemPosition(object); // 系统默认返回的是     POSITION_UNCHANGED，未改变
        return POSITION_NONE;// 返回发生改变，让系统重新加载,刷新fragment
    }
}
